Well, the following test program results in the same warning. Here I am storing the result of the modulus operation on an unsigned long long, which on my system is 64 bytes.
Code:
#include <stdio.h>
#define BOUND 0x100000000 /* 2^32 */
int main (int argc, char* argv[]) {
unsigned long long temp = 256 % BOUND;
printf("sizeof(unsigned long long) = %d\n", sizeof(unsigned long long));
printf("result: %lld\n", temp);
return 0;
}
Now you can run that program fine apparently, but it still compiles with this damn warning.
Code:
[tja@Linux 17:55:49] ~/Programs/sha ]$ gcc -Wall -o test test.c
test.c: In function ‘main’:
test.c:5: warning: integer constant is too large for ‘long’ type
[tja@Linux 17:56:58] ~/Programs/sha ]$ ./test
sizeof(unsigned long long) = 8
result: 256
EDIT: tabstop, I think you hit the nail on the head. Wow, it seems I was lost in a storm of confusion. I see clearly now that simply summing the unsigned integers will give me my overflow and thus, addition modulo 2^32. While reading the specifications I took what they were saying quite literally. Thanks for the replies...its funny how you can overlook something simple like this.